package com.cskaoyan.service;

import com.cskaoyan.anno.CountTime;
import org.springframework.stereotype.Service;

/**
 * @author stone
 * @date 2021/12/28 10:51
 */
@Service
public class UserServiceImpl implements UserService{
    @CountTime
    @Override
    public void sayHello() {
        System.out.println("hello world");
        try {
            Thread.sleep(5);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    //如果我们想要增强sayHello2和sayHello3，假设不考虑参数
    //execution(void com.cskaoyan.service..sayHello*)
    //execution(void com.cskaoyan.service..sayHello*(*)) //单个*代表任意单个参数
    //execution(void com.cskaoyan.service..sayHello*(*,*)) //单个*代表任意单个参数

    //execution(void com.cskaoyan.service.UserServiceImpl.sayHello2(String))
    @CountTime
    @Override
    public void sayHello2(String username) {
        System.out.println("hello world2");
        try {
            Thread.sleep(5);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
    //execution(void com.cskaoyan.service.UserServiceImpl.sayHello3(String,Integer))
    //execution(void com.cskaoyan.service.UserServiceImpl.sayHello3(String,String))
    @Override
    public void sayHello3(String username, Integer age) {
        System.out.println("hello world3");
        try {
            Thread.sleep(5);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
